package com.blog.back.service.impl;

import com.blog.back.dao.ext.ArticleInfoExtMapper;
import com.blog.utils.PageUtils;
import com.blog.utils.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.blog.back.dao.ArticleInfoDao;
import com.blog.entity.ArticleInfoEntity;
import com.blog.back.service.ArticleInfoService;


@Service("articleInfoService")
public class ArticleInfoServiceImpl extends ServiceImpl<ArticleInfoDao, ArticleInfoEntity> implements ArticleInfoService {

    @Autowired
    ArticleInfoExtMapper articleInfoExtMapper;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<ArticleInfoEntity> page = this.page(
                new Query<ArticleInfoEntity>().getPage(params),
                new QueryWrapper<ArticleInfoEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public void mergeInfoHit(Long id) {
        articleInfoExtMapper.updateInfoHit(id);
    }
}